﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.ComponentModel;

namespace SharedCode.Controls
{
    public partial class LoadingBar : UserControl, INotifyPropertyChanged
    {
        Storyboard st = null;

        public LoadingBarAction Action
        {
            get;
            set;
        }
        
        public LoadingBar()
        {
            InitializeComponent();
            Loaded += new RoutedEventHandler(LoadingBar_Loaded);
        }

        void LoadingBar_Loaded(object sender, RoutedEventArgs e)
        {
            this.DataContext = this;

            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs("Action"));
            }

            //st = this.Resources["Storyboard1"] as Storyboard;
        }

        public void Show()
        {
            this.Visibility = Visibility.Visible;
            //st.Begin();
        }

        public void Collapse()
        {
            this.Visibility = Visibility.Collapsed;
            //st.Pause();
        }

        public event PropertyChangedEventHandler PropertyChanged;

        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {

        }

    }

    public enum LoadingBarAction
    {
        сохранение,
        загрузка
    }
}
